<template>
	<view class="apps">
		<uv-status-bar></uv-status-bar>
		<uv-line></uv-line>
		<view class="flex aic ptb20 plr20">
			<view class="f14 pr20">身体指数</view>
			<view v-if="health.BMI !=''" class="f16 green f1">{{health.BMI}}</view>
			<view v-else class="f14 c9 f1" @click="handle('/pages/health/health')">请填写基本情况</view>
		</view>
		<uv-line></uv-line>
		<view class="logo">
			<image :src="logo"></image>
		</view>
		<uv-grid :border="false" :col='3'>
			<uv-grid-item v-for="(item,index) in list" :key="index" @click="handle(item.url)">
				<uv-icon :customStyle="{paddingTop:20+'rpx',color:'#00aa7f'}" :name="item.icon" :size="40"></uv-icon>
				<view class="f16" style="color:#00aa7f">{{item.name}}</view>
			</uv-grid-item>
		</uv-grid>
	</view>
</template>

<script>
	let app;
	export default {
		data() {
			return {
				health:{
					BMI:""
				},
				logo:"https://liliao.lifecloud.top/static/images/logo.jpg",
				list:[
					{'name':'健康档案','url':"/pages/health/health",'icon':'heart-fill'},
					{'name':'我要理疗','url':"/pages/health/action",'icon':'play-circle-fill'},
					{'name':'会员中心','url':"/pages/member/member",'icon':'account-fill'}
				]
			}
		},
		onLoad() {
			app = this;
			setTimeout(function(){
				app.getHealth();
			},2000)
			
		},
		methods: {
			handle(e){
				if( uni.getStorageSync('xxx_token') ){
					uni.navigateTo({
						url:e,
					})
				}else{
					uni.navigateTo({
						url:'/pages/login/login',
					})
				}
				
			},
			getHealth(){
				app.request({
					url:"/mpwechat/health",
					type:"post",
					success:function(rlt){
						if(rlt.code == 1){
							app.health = rlt.data;
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.logo{width:400rpx;height:400rpx; margin:0 auto;}
	.logo image{width:100%;height:100%;}
</style>
